<?php
/**
 * Joomla! 1.5 component ArticleCashRewards
 *
 * @version $Id: view.html.php 2009-05-10 01:47:01 svn $
 * @author Maverick
 * @package views.userearnings
 * @subpackage ArticleCashRewards
 * @license GNU/GPL
 * Website: http://www.boddunan.com
 *
 * Review and approve the articles and assign points and cash rewards.
 * Users can see their articles and the points/cash rewards assigned in the front-end module.
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

// Import Joomla! libraries
jimport( 'joomla.application.component.view');
class ArticleCashRewardsViewReports extends JView {
	
    function display($tpl = null) {

        global $acr_config;
		JToolBarHelper::custom('cpanel', 'default.png', 'default.png', JText::_('TITLE_CPANEL'), false);

        if($this->getLayout() == 'userearnings'){
    		JToolBarHelper::title("&nbsp;&nbsp;&nbsp;&nbsp;" . JText::_('ArticleCashRewards').': <small><small>[ ' . JText::_('PAGE_USER_EARNINGS') .' ]</small></small>', 'acr-48.png');
            $model = $this->getModel('reports');

            $result 	=& $model->getEarningsReport();
            $pagination =& $model->getPagination(1);
            $params 	= JComponentHelper::getParams('com_articlecashrewards');

            $this->assignRef('rows', $result->rows);
            $this->assignRef('lists', $result->lists);
            $this->assignRef('pagination', $pagination);

            $this->assignRef('params', $params);
        }else if($this->getLayout() == 'pendingpayments'){
            JToolBarHelper::custom('makepay', 'makepay.png', 'makepay.png', JText::_('TITLE_PROCESS_PAY'), true);
            JToolBarHelper::title("&nbsp;&nbsp;&nbsp;&nbsp;" . JText::_('ArticleCashRewards').': <small><small>[ ' . JText::_('PAGE_PENDING_PAYMENTS') .' ]</small></small>', 'acr-48.png');

            $model = $this->getModel('reports');

            $pagination =& $model->getPagination(2);
            $result 	=& $model->getPaymentReport(STATUS_PENDING);
            $params 	= JComponentHelper::getParams('com_articlecashrewards');

            $this->assignRef('rows', $result);
            $this->assignRef('pagination', $pagination);

            $this->assignRef('params', $params);
        }else if($this->getLayout() == 'processed'){
            JToolBarHelper::title("&nbsp;&nbsp;&nbsp;&nbsp;" . JText::_('ArticleCashRewards').': <small><small>[ ' . JText::_('LABEL_PROCESSED') .' ]</small></small>', 'acr-48.png');
            $model = $this->getModel('reports');

            $pagination =& $model->getPagination(3);
            $result 	=& $model->getPaymentReport(STATUS_APPROVED);
            $params 	= JComponentHelper::getParams('com_articlecashrewards');

            $this->assignRef('rows', $result);
            $this->assignRef('pagination', $pagination);

            $this->assignRef('params', $params);
        }else if($this->getLayout() == 'recalcpage'){
            JToolBarHelper::title("&nbsp;&nbsp;&nbsp;&nbsp;" . JText::_('ArticleCashRewards').': <small><small>[ ' . JText::_('PAGE_RECALCULATE_EARNINGS') .' ]</small></small>', 'acr-48.png');
        }
		JToolBarHelper::preferences('com_articlecashrewards', '250');
        $this->assignRef('acr_config', $acr_config);

        parent::display($tpl);
    }
}
?>